import java.sql.ResultSet;
import java.sql.SQLException;

import Model.Advertisement;
import Model.Car;
import Model.CarList;
import Model.Faq;
import Model.Role;
import Model.User;



public class Main {

	public static void main(String [] args) throws SQLException{
		System.out.println("Czołem to żyje");
		
		Role x = new Role();
		x.getAllRole();
		
		ResultSet result = x.getRoleById(1);
		
		result.next();
		System.out.println(result.getInt(1));
		System.out.println(result.getString(2));
		
		
		User u = new User();
		u.updateUser(16,"TestoweImie", "Test@test.pl", "TestLOGINNOWY", "haslo?", 1);
		u.setUser("x");
		System.out.println(u.getEmail());
		System.out.println(u.getIdUser());
		System.out.println(u.getLogin());
		System.out.println(u.getName());
		System.out.println(u.getPass());
		System.out.println(u.getRole());
		
		
		Faq faq = new Faq(4);
		System.out.println(faq.getAnswer());
		System.out.println(faq.getDatePub());
		System.out.println(faq.getIdAdvertising());
		System.out.println(faq.getIdFaq());
		System.out.println(faq.getIdUserQuestion());
		System.out.println(faq.getQuestion());
		
		//faq.insertFaq(1, "ala", "ala", "2010-09-07 00:56:04",2);
		//faq.deleteFaqById(2);
		//faq.updateFaq(1, "ala", "ala", "2010-01-01 00:01:01",2,1);
		
		
		
		Advertisement a = new Advertisement(4);
		System.out.println(a.getIdAd());
		System.out.println(a.getContent());
		System.out.println(a.getCrashed());
		System.out.println(a.getDatePub());
		System.out.println(a.getDateUpdate());
		System.out.println(a.getDistance());
		System.out.println(a.getIdCar());
		System.out.println(a.getIdOwner());
		System.out.println(a.getPrice());
		System.out.println(a.getTitle());
		System.out.println(a.getYear());
		
		
		a.insertAdvertisement(2, "xx", "xx","2011-01-23", "201-02-02", 1, 123.22, 123, "2013-04-01", false);
		//a.deleteAdvertisementById(3);
		a.updateAdvertisement(2, "aa", "xx","2011-01-23", "201-02-02", 1, 123.22, 123, "2013-04-01", false,4);
		
		
		
		
		
		Car c = new Car(1);
		System.out.println(c.getDoors());
		System.out.println(c.getEngine());
		System.out.println(c.getIdCar());
		System.out.println(c.getMark());
		System.out.println(c.getMaxSpeed());
		System.out.println(c.getModel());
		System.out.println(c.getName());
		
		c.insertCar(123, "antek", "xx", "xxxx", 2, 123);
		//c.deleteCarById(2);
		c.updateCar(333, "qqq", "qqq", "qqq", 123, 123, 1);
		
		
		
		
		System.out.println("XXXXXXXXXXXXXXXXx");
		
		CarList lista = new CarList();
		c = lista.CarList.get(2);
		//u.deleteUserById(1);
		
		
		//u.deleteUserById(14);
		//u.deleteUserById(15);
		/*x.ala();
		DbConnection x = new DbConnection();
		x.initDB();
		*/
	}
	
}
